#include "node.h"
namespace AI
	{
	node::node( const node& other )
		{
		this->value=other.value;
		this->h=other.value;
		this->p=other.p;
		this->child=other.child;
		this->parent=other.parent;
		}
	node::node(int v, AI::link *_parent)
		{
		this->value=v;
		if(_parent!=NULL)
			{
			this->parent.push_back(_parent);
			}
		this->h=2*(int)((value-1)/2);
		p=NULL;
		if(isGoal())
			{
			solved=true;
			}
		else solved=false;
		}
	node& node::operator =(const AI::node &other)
		{
		this->value=other.value;
		this->h=other.value;
		this->p=other.p;
		this->child=other.child;
		this->parent=other.parent;
		return *this;
		}
	bool node::isGoal()
		{
		if(value==1||value==2)
			{
			return true;
			}
		else return false;
		}
	int node::getValue()
		{
		return value;
		}
	}
	